package offertest.test02;

/**
 * @ClassName test2
 * @Description
 * @Author ZJX
 * @Date 2025/4/7 19:28
 * @Version 1.0
 **/
public class Test2 {
//    抢红包  100元 3个名额 5个人抢 输出每个人抢了多少
    public static void main(String[] args) throws InterruptedException {
        Thread t1 = new M2();
        Thread t2 = new M2();
        Thread t3 = new M2();
        Thread t4 = new M2();
        Thread t5 = new M2();



        t1.setName("第1个人");
        t2.setName("第2个人");
        t3.setName("第3个人");
        t4.setName("第4个人");
        t5.setName("第5个人");


        t1.start();
        t2.start();
        t3.start();
        t4.start();
        t5.start();

        // 等待所有线程完成
        t1.join();
        t2.join();
        t3.join();
        t4.join();
        t5.join();


    }
}
